//
//  MKUITabBarItemFlowContainer.h
//  MKUI
//  使用MKUItemFlowCollectionView，实现tabbar的标签容器
//  Created by 苏尚进 on 2023/10/23.
//  Copyright © 2023 moon. All rights reserved.
//

#import "MKUITabBarItemContainer.h"
#import "MKUItemFlowCollectionView.h"
#import "MKUIFlowLayoutButton.h"
#import "MKUICustomTabBar.h"
NS_ASSUME_NONNULL_BEGIN

@class MKUITabBarItemFlowContainer;
@protocol MKUITabBarItemFlowContainerDelegate <NSObject>
@optional
- (CGSize)tabBarItemFlowContainer:(MKUITabBarItemFlowContainer *)view itemSizeAtIndex:(NSInteger)index collectionCellModel:(MKUICollectionViewCellModel *)cellModel;//返回指定item的单元格尺寸值
- (Class)tabBarItemFlowContainer:(MKUITabBarItemFlowContainer *)view itemCellClassAtIndex:(NSInteger)index;//返回指定item的单元格类型，需要为MKUICollectionViewCellBase的子类
- (void)tabBarItemFlowContainer:(MKUITabBarItemFlowContainer *)view didSelectIndex:(NSInteger)selectedIndex;//点击指定item的回调
- (CGSize)separatorSizeOfTabBarItemFlowContainer:(MKUITabBarItemFlowContainer *)view;//返回分隔线单元格的尺寸值
@end

@interface MKUITabBarItemFlowContainer : MKUITabBarItemContainer
@property(nonatomic,readonly) MKUItemFlowCollectionView *flowColletionView;
@property(nonatomic,weak,nullable) id<MKUITabBarItemFlowContainerDelegate> delegate;

//tabBarItem显示单元格优先级为：delegate的itemCellClassAtIndex方法 > MKUICustomTabBarItem.itemCellClass > self.itemCollectionCellClass
//tabBarItem标签显示单元格，默认是MKUITabBarItemFlowCellView.变更时，不会刷新UI，需要手动调用reload。
@property(nonatomic,assign) Class itemCollectionCellClass;


//分隔线的显示类，nil代表不要显示分隔线。值变更时，不会主动刷新UI，需要手动调用reload方法。可选值为MKUItemFlowSeparatorView,默认为nil,代表不显示
@property(nonatomic,assign,nullable) Class separatorViewClass;
@property(nonatomic,strong,nullable) UIColor *separatorColor;//当separatorViewClass为MKUItemFlowSeparatorView时，指定分隔线颜色，默认为UIColor.mk_listViewSeparatorColor
@property(nonatomic,assign) CGSize separatorSize;//当separatorViewClass为MKUItemFlowSeparatorView时，指定分隔线尺寸值,默认为(0,0)，代表不显示分隔线

//tabBarItem标签选中指示器视图类,nil代表不需要指示器。变更时不会刷新UI，需要调用reload刷新。可选值为MKUItemFlowIndicatorLineView，默认为nil,代表不显示
@property(nonatomic,assign,nullable) Class itemIndicatorViewClass;
@property(nonatomic,readonly,nullable) __kindof UIView *itemIndicatorView;
@end

//注意：自定义cell，需要在.m中添加：MKDEF_SINGLETON(MKUITabBarItemFlowCellView)
@interface MKUITabBarItemFlowCellView : MKUItemFlowCellView
@property(nonatomic,readonly,nullable) __kindof UITabBarItem *tabBarItem;
@property(nonatomic,readonly) MKUIFlowLayoutButton *tabBarItemButton;//左图片，右文本的按钮
@property(nonatomic,readonly) MKUICustomTabBarItemBadgeView *badgeView;//图片右上角的角标视图
@end
NS_ASSUME_NONNULL_END

#import "MKUITabBarController.h"
NS_ASSUME_NONNULL_BEGIN
@interface MKUITabBarController(MKUITabBarItemFlowContainer)
@property(nonatomic,readonly,nullable) MKUITabBarItemFlowContainer *itemFlowContainer;
@end
NS_ASSUME_NONNULL_END

NS_ASSUME_NONNULL_BEGIN
@interface MKUITabBarItemFlowContainer(MKUItemFlowIndicatorLineView)
@property(nonatomic,readonly,nullable) __kindof MKUItemFlowIndicatorLineView *itemIndicatorLineView;
@end
NS_ASSUME_NONNULL_END
